package com.lhx.arrray.bilibili;

import java.util.Arrays;

public class array_21 {
    public static int largestPerimeter(int[] nums) {
        Arrays.sort(nums);
        for(int i=nums.length-1; i>=2; i--) {
            if(nums[i-1]+nums[i-2]>nums[i]) {
                return nums[i-1]+nums[i-2]+nums[i];
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{3,6,2,3};
        System.out.println("最长的周长为："+largestPerimeter(nums));
    }
}
